include(GoogleTest)

# ── Unit Tests ────────────────────────────────────────────────────────────────
add_executable(unit_tests
    unit/ControllerTest.cpp
    unit/SensorTest.cpp
)
target_include_directories(unit_tests PRIVATE
    ${CMAKE_SOURCE_DIR}/src
    ${CMAKE_CURRENT_SOURCE_DIR}/unit
)
target_link_libraries(unit_tests
    rvc_lib
    GTest::gtest_main
    GTest::gmock
)
# LABELS so CI can select this executable's tests with `ctest -L unit`
# (gtest_discover_tests registers GoogleTest names like ControllerTest.*, so
#  filtering by the target name via `-R unit_tests` would match nothing.)
gtest_discover_tests(unit_tests PROPERTIES LABELS unit)

# ── Integration Tests ─────────────────────────────────────────────────────────
add_executable(integration_tests
    integration/RVCSystemTest.cpp
)
target_include_directories(integration_tests PRIVATE
    ${CMAKE_SOURCE_DIR}/src
    ${CMAKE_CURRENT_SOURCE_DIR}/unit
)
target_link_libraries(integration_tests
    rvc_lib
    GTest::gtest_main
    GTest::gmock
)
gtest_discover_tests(integration_tests PROPERTIES LABELS integration)

# ── System Tests ──────────────────────────────────────────────────────────────
add_executable(system_tests
    system/RVCSimulatorTest.cpp
)
target_link_libraries(system_tests
    simulator_lib
    GTest::gtest_main
)
gtest_discover_tests(system_tests PROPERTIES LABELS system)
